/**
 * VehicleApplicationsReportAction.java
 */
package com.prs.crm.action.oa;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.action.ReportAction;
import com.prs.crm.domain.ca.work.ProcureStore;
import com.prs.crm.domain.oa.VehicleApplications;
import com.prs.crm.report.ExportConfig;
import com.prs.crm.report.ReportCell;
import com.prs.crm.report.ReportTable;

/**
 * @author ZhuDongMei
 * @E-mail:1223984339@qq.com
 * @qq:1223984339
 * @version 创建时间：2011-3-16 上午11:12:28 简单说明
 */
/**
 * @author Administrator
 *
 */
public class VehicleApplicationsReportAction extends ReportAction {
	private static final long serialVersionUID = 1L;
	private PaginationSupport pagination;
	public PaginationSupport getPagination() {
		return pagination;
	}
	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	@Action(value="exportHistory", results = { @Result(name = "success"
		,type="stream",params={"contentType","${contentType}","inputName","inputStream"
		,"bufferSize","1024","contentDisposition","filename=${outfileName}"}) })
	public String exportHistory()
	{
		ReportTable table = new ReportTable("用车历史记录");
		table.addCell(new ReportCell("用车人","carMan"));
		table.addCell(new ReportCell("所用车辆","vehicle.code"));
		table.addCell(new ReportCell("开始时间","startTime"));
		table.addCell(new ReportCell("结束时间","endTime"));
		table.addCell(new ReportCell("其他费用","otherCost"));
		table.addCell(new ReportCell("里程数","mileage"));
		table.addCell(new ReportCell("驾驶员","vehicle.driver"));
		table.addCell(new ReportCell("派车人","recorder.resume.name"));
		table.addCell(new ReportCell("状态","state"));
		DetachedCriteria criteria = this.getPaginationHelper().createQuery(VehicleApplications.class).add(Restrictions.eq("remark", "派车"));
		this.setOutFilePath(this.getReportService().report(criteria, table, new ExportConfig(),this.getExportType()));
		return SUCCESS;
	}
}
